home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / uconv / nsIUTF8ConverterService.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  6KB  |  141 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIUTF8ConverterService.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIUTF8ConverterService_h__
  6. #define __gen_nsIUTF8ConverterService_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17.  
  18. /* starting interface:    nsIUTF8ConverterService */
  19. #define NS_IUTF8CONVERTERSERVICE_IID_STR "249f52a3-2599-4b00-ba40-0481364831a2"
  20.  
  21. #define NS_IUTF8CONVERTERSERVICE_IID \
  22.   {0x249f52a3, 0x2599, 0x4b00, \
  23.     { 0xba, 0x40, 0x04, 0x81, 0x36, 0x48, 0x31, 0xa2 }}
  24.  
  25. class NS_NO_VTABLE nsIUTF8ConverterService : public nsISupports {
  26.  public: 
  27.  
  28.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUTF8CONVERTERSERVICE_IID)
  29.  
  30.   /**
  31.    * Ensure that |aString| is encoded in UTF-8.  If not, 
  32.    * convert to UTF-8 assuming it's encoded in |aCharset|
  33.    * and return the converted string in UTF-8.
  34.    *
  35.    * @param aString a string to  ensure its UTF8ness
  36.    * @param aCharset the charset to convert from if |aString| is not in UTF-8
  37.    * @param aSkipCheck determines whether or not to skip 'ASCIIness' and 
  38.    *        'UTF8ness' check. Set this to PR_TRUE only if you suspect that 
  39.    *        aString can be mistaken for ASCII / UTF-8 but is actually NOT 
  40.    *        in ASCII / UTF-8 so that aString has to go through the conversion.
  41.    *        skipping ASCIIness/UTF8ness check.
  42.    *        The most common case is the input is in 7bit non-ASCII charsets
  43.    *        like ISO-2022-JP, HZ or UTF-7 (in its original form or
  44.    *        a modified form used in IMAP folder names).
  45.    * @return the converted string in UTF-8.
  46.    * @throws NS_ERROR_UCONV_NOCONV when there is no decoder for aCharset
  47.    *         or error code of nsIUnicodeDecoder in case of conversion failure
  48.    */
  49.   /* AUTF8String convertStringToUTF8 (in ACString aString, in string aCharset, in boolean aSkipCheck); */
  50.   NS_IMETHOD ConvertStringToUTF8(const nsACString & aString, const char *aCharset, PRBool aSkipCheck, nsACString & _retval) = 0;
  51.  
  52.   /**
  53.    * Ensure that |aSpec| (after URL-unescaping it) is encoded in UTF-8.  
  54.    * If not,  convert it to UTF-8, assuming it's encoded in |aCharset|,  
  55.    * and return the result.
  56.    *
  57.    * <p>Make sure that all characters outside US-ASCII in your input spec 
  58.    * are url-escaped if  your spec is not in UTF-8 (before url-escaping) 
  59.    * because the presence of non-ASCII characters is <strong>blindly</strong>
  60.    * regarded as an indication that your input spec is in unescaped UTF-8
  61.    * and it will be returned without further processing. No valid spec
  62.    * going around in Mozilla code would break this assumption. 
  63.    *
  64.    * <p>XXX The above may change in the future depending on the usage pattern.
  65.    *
  66.    * @param aSpec an url-escaped URI spec to  ensure its UTF8ness
  67.    * @param aCharset the charset to convert from if |aSpec| is not in UTF-8
  68.    * @return the converted spec in UTF-8.
  69.    * @throws NS_ERROR_UCONV_NOCONV when there is no decoder for aCharset
  70.    *         or error code of nsIUnicodeDecoder in case of conversion failure
  71.    */
  72.   /* AUTF8String convertURISpecToUTF8 (in ACString aSpec, in string aCharset); */
  73.   NS_IMETHOD ConvertURISpecToUTF8(const nsACString & aSpec, const char *aCharset, nsACString & _retval) = 0;
  74.  
  75. };
  76.  
  77. /* Use this macro when declaring classes that implement this interface. */
  78. #define NS_DECL_NSIUTF8CONVERTERSERVICE \
  79.   NS_IMETHOD ConvertStringToUTF8(const nsACString & aString, const char *aCharset, PRBool aSkipCheck, nsACString & _retval); \
  80.   NS_IMETHOD ConvertURISpecToUTF8(const nsACString & aSpec, const char *aCharset, nsACString & _retval); 
  81.  
  82. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  83. #define NS_FORWARD_NSIUTF8CONVERTERSERVICE(_to) \
  84.   NS_IMETHOD ConvertStringToUTF8(const nsACString & aString, const char *aCharset, PRBool aSkipCheck, nsACString & _retval) { return _to ConvertStringToUTF8(aString, aCharset, aSkipCheck, _retval); } \
  85.   NS_IMETHOD ConvertURISpecToUTF8(const nsACString & aSpec, const char *aCharset, nsACString & _retval) { return _to ConvertURISpecToUTF8(aSpec, aCharset, _retval); } 
  86.  
  87. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  88. #define NS_FORWARD_SAFE_NSIUTF8CONVERTERSERVICE(_to) \
  89.   NS_IMETHOD ConvertStringToUTF8(const nsACString & aString, const char *aCharset, PRBool aSkipCheck, nsACString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ConvertStringToUTF8(aString, aCharset, aSkipCheck, _retval); } \
  90.   NS_IMETHOD ConvertURISpecToUTF8(const nsACString & aSpec, const char *aCharset, nsACString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ConvertURISpecToUTF8(aSpec, aCharset, _retval); } 
  91.  
  92. #if 0
  93. /* Use the code below as a template for the implementation class for this interface. */
  94.  
  95. /* Header file */
  96. class nsUTF8ConverterService : public nsIUTF8ConverterService
  97. {
  98. public:
  99.   NS_DECL_ISUPPORTS
  100.   NS_DECL_NSIUTF8CONVERTERSERVICE
  101.  
  102.   nsUTF8ConverterService();
  103.  
  104. private:
  105.   ~nsUTF8ConverterService();
  106.  
  107. protected:
  108.   /* additional members */
  109. };
  110.  
  111. /* Implementation file */
  112. NS_IMPL_ISUPPORTS1(nsUTF8ConverterService, nsIUTF8ConverterService)
  113.  
  114. nsUTF8ConverterService::nsUTF8ConverterService()
  115. {
  116.   /* member initializers and constructor code */
  117. }
  118.  
  119. nsUTF8ConverterService::~nsUTF8ConverterService()
  120. {
  121.   /* destructor code */
  122. }
  123.  
  124. /* AUTF8String convertStringToUTF8 (in ACString aString, in string aCharset, in boolean aSkipCheck); */
  125. NS_IMETHODIMP nsUTF8ConverterService::ConvertStringToUTF8(const nsACString & aString, const char *aCharset, PRBool aSkipCheck, nsACString & _retval)
  126. {
  127.     return NS_ERROR_NOT_IMPLEMENTED;
  128. }
  129.  
  130. /* AUTF8String convertURISpecToUTF8 (in ACString aSpec, in string aCharset); */
  131. NS_IMETHODIMP nsUTF8ConverterService::ConvertURISpecToUTF8(const nsACString & aSpec, const char *aCharset, nsACString & _retval)
  132. {
  133.     return NS_ERROR_NOT_IMPLEMENTED;
  134. }
  135.  
  136. /* End of implementation class template. */
  137. #endif
  138.  
  139.  
  140. #endif /* __gen_nsIUTF8ConverterService_h__ */
  141.